#include<stdio.h>
#include<string.h>

int main()
{
	FILE * fp;
	fp = fopen("out.txt","w");
	if(fp==NULL){
		printf("打开文件失败!\n");
		return -1;
	}else{
		char buffer[100];
		while(1){
			gets(buffer);  //键盘输入
			if(strcmp(buffer,"quit")==0){
				break;
			}
			fputs(buffer,fp); //输出字符内容到文件
			fputc('\n',fp);   //输出换行符到文件
		}

		fclose(fp);
	}
	
	return 0;
}
